package com.cn.springcloudwechat.service.pay;


import com.cn.springcloudwechat.common.utils.HttpPostUtil;
import com.cn.springcloudwechat.common.weiXinPay.WeiXinPayConfig;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;


@Service("payService")
public class PayServiceImpl implements PayService {

    @Override
    public void aliPay() {

    }

    @Override
    public Map<Object, Object> weChatPay(HttpServletRequest request,Integer totalFee,String body) {
        String init = WeiXinPayConfig.init(request,totalFee,body);
        String result = HttpPostUtil.sendPost(WeiXinPayConfig.pay_url, init);
        return WeiXinPayConfig.secondSign(result);
    }



}
